/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tree;

/**
 *
 * @author Ej-Dý
 */
public class ArgumentTree extends Tree {

    private SymTab s;
    private int pocet;

    public ArgumentTree(Position start, Position end,SymTab s, int pocet){
        super(start,end);
        this.s=s;
        this.pocet=pocet;


    }
     public int getPocet() {
        return pocet;
    }
    public SymTab getSymTab() {
        return s;
    }

    @Override
    public void accept(TreeVisitor visitor) {
        visitor.visitArgument(this);
    }

    @Override
    public void generate(Context ctx){
        assert false;
    }


    public void generate(Context ctx,Type t) {
        if(t==Type.INTEGER){
        for(int i=0;i<pocet;i++){
            ctx.print("I");
        }
        }else{
            for(int i=0;i<pocet;i++){
            ctx.print("D");
        }
        }
    }

    @Override
    public String toString(){
        return String.format("Argument %s: [%s,%d]", super.toString(), s, pocet);
    }


}
